# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ntdsxtract
pkgver=34.7fa1c8c
pkgrel=3
pkgdesc='Active Directory forensic framework.'
groups=('blackarch' 'blackarch-forensic')
arch=('any')
url='https://github.com/csababarta/ntdsxtract'
license=('GPL3')
depends=('python2')
makedepends=('git' 'python2-setuptools')
source=("git+https://github.com/csababarta/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python2 setup.py build
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  python2 setup.py install --root="$pkgdir" --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  for i in $pkgdir/usr/bin/*.py ; do
    mv $i `echo $i | sed 's/\.py//'`
  done
}

